#include <iostream>
using std::cout;
using std::endl;

class A
{
public:
    void print() const{
        cout << "A::print()" << endl;
    }
    double _a = 1;
};

class B
: public A
{
public:
    double _b = 2;
};

class C
: public A
{
public:
    double _c = 3;
};

class D
: public B
, public C
{
public:
    void print() const{
        cout << "D::print()" << endl;
    }

    double _d = 4;
};

void test0(){
    D d;
    cout << sizeof(d) << endl;
    //D类对象调用print时需要通过A类子对象调用
    //此时D类对象中存在两份A类子对象
    /* d.A::print();//error */
    d.B::print();
    d.C::print();
    d.print();
}

int main(void){
    test0();
    return 0;
}
